const {Sequelize} = require('sequelize');

const {SQLITE_HOST, SQLITE_DB} = require('../config/config.default');

const seq = new Sequelize({
    dialect: 'sqlite',
    storage: SQLITE_HOST + SQLITE_DB
});

async function connect() {
    try {
        await seq.authenticate();
        console.log(`sqlite连接地址：${SQLITE_HOST + SQLITE_DB}`);
        console.log('sqlite连接成功！');
    } catch (error) {
        console.error('sqlite连接失败！错误原因：', error);
    }
}

connect();

module.exports = seq;